package com.sss.portalrimac.web.ejecutarcambiocontrasena.controller;

import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.sss.portalrimac.application.ClienteService;
import com.sss.portalrimac.domain.Cliente;

@RequestMapping("VIEW")
public class EjecutarCambioContrasenaController
{
	public static final String VIEW_EJECUTAR_CAMBIO_CONTRASENA = "ejecutarCambioContrasena/ejecutar";
	private ClienteService clienteService;

	public EjecutarCambioContrasenaController(ClienteService clienteService)
	{
		this.clienteService = clienteService;
	}

	@RequestMapping
	public String ejecutar(RenderRequest request, RenderResponse response, Model model) throws Exception
	{
		try
		{
			Cliente cliente = clienteService.obtenerClienteActual(request, response);
			model.addAttribute(cliente);
		}
		catch (Exception e)
		{
			model.addAttribute("mensaje", "");
		}
		return VIEW_EJECUTAR_CAMBIO_CONTRASENA;
	}
}
